<?php
// $dir = "test/";
// $sql = "INSERT IGNORE INTO `lessons` (`year_id`,`lecturer_id`,`series_id`,`date`,`number`,`sufix`,`name`,`old_name`) VALUES ";
// if (is_dir($dir)){
// 	if ($dh = opendir($dir)){
// 		while (($file_name = readdir($dh)) !== false){
// 			if($file_name === '.' || $file_name === '..') {continue;}
// 			$file_name_utf = iconv ( "windows-1255" , "UTF-8", $file_name ) ;
// 			$details = explode("_", $file_name_utf);
// 			$new_file_name = rand()."_".time();
// 			if(count($details) > 3){
// 				$sql .= "('".implode("','", $details) ."','$new_file_name','$file_name_utf')";
// 				$sql .=" , \n";
// 			}
// 			$file_name = iconv ("UTF-8","windows-1255", $file_name_utf ) ;
// 			copy("test/".$file_name, $new_file_name.".mp3");
// 		}
// 		closedir($dh);
// 	}
// }
// $sql = trim(trim($sql),",");
// $sql = str_replace(".mp3", "','mp3", $sql);
// $sql = str_replace(".WMA", "','WMA", $sql);
// $sql = str_replace(".wav", "','wav", $sql);

// $sql = str_replace(",'mp3')", ")", $sql);
// $sql = str_replace(",'WMA')", ")", $sql);
// $sql = str_replace(",'wav')", ")", $sql);
// // $sql = str_replace("הרב פודי", "1", $sql);
// $conn = App_Db::getInstance();
// $conn = $conn->getConn();
// $resuls = $conn->query($sql);
// $rows = array();
// $resuls = $conn->query('SELECT * FROM `lessons`');
// while($row = $resuls->fetch_object()){
// 	$rows[] = $row;
// }
?>
<table border="1" style="padding: 5px">
<thead>
<tr>
		<th>#</th>
		<th>שנה</th>
		<th>שם מרצה</th>
		<th>תאריך</th>
		<th>סדרה</th>
		<th>מספר בסידרה</th>
		<th>סוג קובץ</th>
		<th>שם בשרת</th>
		<th>שם מקורי</th>
</tr>
</thead>
<tbody>
<?php 

foreach ($rows as $key=>$row){
	?>
	<tr>
		<td><?php echo $key?></td>
		<td><?php echo $row->year_id?></td>
		<td><?php echo $row->lecturer_id?></td>
		<td><?php echo $row->date?></td>
		<td><?php echo $row->series_id?></td>
		<td><?php echo $row->number?></td>
		<td><?php echo $row->sufix?></td>
		<td><?php echo $row->name?></td>
		<td><?php echo $row->old_name?></td>
	</tr>
	<?php 
}
?>
</tbody>
</table>
<?php 
// echo nl2br($sql);

